fix: parse link (a tag) in post messages - #144
Conversation
Post messages containing only links were parsed as empty because the parser only extracted 'text' tag elements, ignoring 'a' (link) tags. This caused rootId injection and fetchRecentMessages to skip link-only posts, making the bot unable to see links shared in thread topics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @lishuceo's task in 59s —— View job PR Review: fix: parse link (a tag) in post messages
Verdict: ✅ LGTM — No issues found The fix is clean and consistent across all three parsing locations:
All three use the same formatting logic: Minor style note (not blocking): Tests: 4 new test cases cover the key scenarios (pure link, mixed text+link, href-only, text-only). Good coverage. |
Add support for all Feishu post rich text element tags (referencing OpenClaw's implementation): at, img, media, emotion, code_block, md, hr. Previously only text and a were handled, causing content loss. Also add explicit message type placeholders for media, interactive, share_chat, share_user, and system message types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover at, img, media, emotion, code_block, md, hr post tags and media, interactive, share_chat, share_user, system message types. 35 tests total, all passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @lishuceo's task in 1m 15s —— View job PR Review: fix: parse link (a tag) in post messages
Verdict: ✅ LGTM — No blocking issues The PR expanded beyond the original Observations (non-blocking):
Tests: 20+ test cases covering all element tags, edge cases (empty text/href, mixed content), and message type placeholders. Good coverage. |
* fix: parse link (a tag) in post messages to prevent empty_content skip Post messages containing only links were parsed as empty because the parser only extracted 'text' tag elements, ignoring 'a' (link) tags. This caused rootId injection and fetchRecentMessages to skip link-only posts, making the bot unable to see links shared in thread topics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add tests for post messages with link (a tag) elements Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: handle all 9 post element tags and additional message types Add support for all Feishu post rich text element tags (referencing OpenClaw's implementation): at, img, media, emotion, code_block, md, hr. Previously only text and a were handled, causing content loss. Also add explicit message type placeholders for media, interactive, share_chat, share_user, and system message types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add tests for all post element tags and message type placeholders Cover at, img, media, emotion, code_block, md, hr post tags and media, interactive, share_chat, share_user, system message types. 35 tests total, all passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
a标签) 未被解析,导致仅含链接的 post 被当作空内容跳过message-parser.ts、client.ts (fetchRecentMessages)、event-handler.ts (parseMessage)Root Cause
Post 类型消息的解析仅提取
tag === 'text'元素,忽略了tag === 'a'(链接标签)。当 post 仅包含链接时,解析结果为空字符串,被empty_content规则跳过。Fix
在三个位置的 post 解析循环中增加
a标签处理,提取text和href并格式化为[text](href)。Test plan
🤖 Generated with Claude Code